<?php
class ZluykethoigiansController extends AppController {

	var $name = 'Zluykethoigians';
	var $helpers = array('Html', 'Form');

	function index($tg,$id_dv) {
		$this->Zluykethoigian->recursive = 0;
		$this->set('zluykethoigians', $this->paginate(array('Zluykethoigian.id'=>$tg,'donvi_id'=>$id_dv)));
        $this->set(compact('tg','id_dv'));
	}

    function excel($tg,$id_dv) {
        $this->layout='';
		$this->Zluykethoigian->recursive = 0;
		$this->set('zluykethoigians', $this->paginate(array('Zluykethoigian.id'=>$tg,'donvi_id'=>$id_dv)));
	}
	function view($id = null) {
		if (!$id) {
			$this->Session->setFlash(__('Invalid Zluykethoigian.', true));
			$this->redirect(array('action'=>'index'));
		}
		$this->set('zluykethoigian', $this->Zluykethoigian->read(null, $id));
	}

	function add() {
		if (!empty($this->data)) {
			$this->Zluykethoigian->create();
			if ($this->Zluykethoigian->save($this->data)) {
				$this->Session->setFlash(__('The Zluykethoigian has been saved', true));
				$this->redirect(array('action'=>'index'));
			} else {
				$this->Session->setFlash(__('The Zluykethoigian could not be saved. Please, try again.', true));
			}
		}
		$donvis = $this->Zluykethoigian->Donvi->find('list');
		$this->set(compact('donvis'));
	}

	function edit($id = null) {
		if (!$id && empty($this->data)) {
			$this->Session->setFlash(__('Invalid Zluykethoigian', true));
			$this->redirect(array('action'=>'index'));
		}
		if (!empty($this->data)) {
			if ($this->Zluykethoigian->save($this->data)) {
				$this->Session->setFlash(__('The Zluykethoigian has been saved', true));
				$this->redirect(array('action'=>'index'));
			} else {
				$this->Session->setFlash(__('The Zluykethoigian could not be saved. Please, try again.', true));
			}
		}
		if (empty($this->data)) {
			$this->data = $this->Zluykethoigian->read(null, $id);
		}
		$donvis = $this->Zluykethoigian->Donvi->find('list');
		$this->set(compact('donvis'));
	}

	function delete($id = null) {
		if (!$id) {
			$this->Session->setFlash(__('Invalid id for Zluykethoigian', true));
			$this->redirect(array('action'=>'index'));
		}
		if ($this->Zluykethoigian->del($id)) {
			$this->Session->setFlash(__('Zluykethoigian deleted', true));
			$this->redirect(array('action'=>'index'));
		}
	}

}
?>